package me.send.data.service.mapper;

import java.util.List;
import java.util.Map;

import me.send.data.service.BaseMapper;
import me.send.data.service.provider.CommentProvider;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

public abstract interface CommentMapper extends BaseMapper {

	// 提供给单个查询的使用

	@Select(value = "select commentid,context from comment where commentid = #{pcommentid}")
	public abstract Map<String, Object> map_pcommentid(Integer pcommentid);

	// 查询分页 2015年7月9日14:31:04
	@SelectProvider(method = "list_page", type = CommentProvider.class)
	@Results({
			@Result(column = "userid", property = "userid"),
			@Result(column = "userid", property = "user", one = @One(select = user_mapper_all
					+ "map_userid")),
			@Result(column = "pcommentid", property = "pcommentid"),
			@Result(column = "pcommentid", property = "comment", one = @One(select = "map_pcommentid")) })
	public abstract List<Map<String, Object>> list_page(
			Map<String, Object> parameter);

	@SelectProvider(method = "count", type = CommentProvider.class)
	public abstract int count(Map<String, Object> parameter);

	@DeleteProvider(method = "batch_delete", type = CommentProvider.class)
	public abstract void batch_delete(Map<String, Object> parameter);
}
